<?php namespace app\common\service;
use  \app\common\model\OpusCategory as OpusCategoryModel;

/**
 * Class OpusCategory
 * @package app\common\service
 */
class OpusCategory extends Base{
    /**
     * OpusCategory constructor.
     */
    public function __construct()
    {
        parent::__construct();
        $OpusCategoryModel= new OpusCategoryModel();
        $this->model = $OpusCategoryModel;
    }

    /**
     * @param $where
     * @param $page
     * @param int $limit
     * @return array
     */
    public function getList($where, $page, $limit=10){
        try{
            $data=$this->paginatet($where,'*','weigh desc',$limit,$page,'');
            if(!empty($data)){
                foreach ($data as $key=>$val){
                    $val->url=url('category',array('category_id'=>$val['id']),true,true);
                }

            }
        }catch (\Exception $e){
            $data=[];
        }
        return $data;
    }

}